package web;


import spring.cloud.tasks.client.Client;
import spring.cloud.tasks.client.item_task_processor.TaskWorkerScheduleInfo;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

public class scheduleStrategyRuntime {
    public static void main(String[] args) throws Exception {
        HttpServletRequest request = null;
        String taskScheduleInfoId = request.getParameter("id");
        String workerId = request.getParameter("processorId");
        List<TaskWorkerScheduleInfo> taskScheduleInfoList = null;
        if (taskScheduleInfoId != null && taskScheduleInfoId.trim().length() > 0) {
            taskScheduleInfoList = Client.getZooKeeperItemTaskDataManager().loadTaskWorkerScheduleInfoListByTaskId(taskScheduleInfoId);
        } else if (workerId != null && workerId.trim().length() > 0) {
            taskScheduleInfoList = Client.getZooKeeperItemTaskDataManager().loadTaskWorkerScheduleInfoListByWorkerId(workerId);
        } else {
            taskScheduleInfoList = new ArrayList<TaskWorkerScheduleInfo>();
        }

        for (int i = 0; i < taskScheduleInfoList.size(); i++) {
            TaskWorkerScheduleInfo taskWorkerScheduleInfo = taskScheduleInfoList.get(i);
            System.out.println(taskWorkerScheduleInfo.getTaskId());
            System.out.println(taskWorkerScheduleInfo.getWorkerId());
            System.out.println(taskWorkerScheduleInfo.getRequestNum());

        }
    }
}